package b.i.k;

import android.util.Log;
import android.view.View;
import android.view.ViewParent;

/* compiled from: NestedScrollingChildHelper */
public class g {
    public ViewParent a;
    public ViewParent b;
    public final View c;
    public boolean d;
    public int[] e;

    public g(View view) {
        this.c = view;
    }

    public boolean a(float f, float f2, boolean z) {
        boolean z2 = false;
        if (!this.d) {
            return false;
        }
        ViewParent g = g(0);
        if (g == null) {
            return false;
        }
        try {
            z2 = g.onNestedFling(this.c, f, f2, z);
            return z2;
        } catch (AbstractMethodError e) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("ViewParent ");
            stringBuilder.append(g);
            stringBuilder.append(" does not implement interface method onNestedFling");
            Log.e("ViewParentCompat", stringBuilder.toString(), e);
            return z2;
        }
    }

    public boolean b(float f, float f2) {
        boolean z = false;
        if (!this.d) {
            return false;
        }
        ViewParent g = g(0);
        if (g == null) {
            return false;
        }
        try {
            z = g.onNestedPreFling(this.c, f, f2);
            return z;
        } catch (AbstractMethodError e) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("ViewParent ");
            stringBuilder.append(g);
            stringBuilder.append(" does not implement interface method onNestedPreFling");
            Log.e("ViewParentCompat", stringBuilder.toString(), e);
            return z;
        }
    }

    /* JADX WARNING: Missing block: B:31:0x0093, code skipped:
            if (r13[1] == 0) goto L_0x0096;
     */
    public boolean c(int r15, int r16, int[] r17, int[] r18, int r19) {
        /*
        r14 = this;
        r1 = r14;
        r0 = r15;
        r5 = r16;
        r8 = r18;
        r7 = r19;
        r2 = r1.d;
        r9 = 1;
        r10 = 0;
        if (r2 == 0) goto L_0x0096;
    L_0x000e:
        r2 = r14.g(r7);
        if (r2 != 0) goto L_0x0015;
    L_0x0014:
        return r10;
    L_0x0015:
        if (r0 != 0) goto L_0x0022;
    L_0x0017:
        if (r5 == 0) goto L_0x001a;
    L_0x0019:
        goto L_0x0022;
    L_0x001a:
        if (r8 == 0) goto L_0x0096;
    L_0x001c:
        r8[r10] = r10;
        r8[r9] = r10;
        goto L_0x0096;
    L_0x0022:
        if (r8 == 0) goto L_0x0030;
    L_0x0024:
        r3 = r1.c;
        r3.getLocationInWindow(r8);
        r3 = r8[r10];
        r4 = r8[r9];
        r11 = r3;
        r12 = r4;
        goto L_0x0032;
    L_0x0030:
        r11 = 0;
        r12 = 0;
    L_0x0032:
        if (r17 != 0) goto L_0x0041;
    L_0x0034:
        r3 = r1.e;
        if (r3 != 0) goto L_0x003d;
    L_0x0038:
        r3 = 2;
        r3 = new int[r3];
        r1.e = r3;
    L_0x003d:
        r3 = r1.e;
        r13 = r3;
        goto L_0x0043;
    L_0x0041:
        r13 = r17;
    L_0x0043:
        r13[r10] = r10;
        r13[r9] = r10;
        r3 = r1.c;
        r4 = r2 instanceof b.i.k.h;
        if (r4 == 0) goto L_0x0059;
    L_0x004d:
        r2 = (b.i.k.h) r2;
        r4 = r15;
        r5 = r16;
        r6 = r13;
        r7 = r19;
        r2.j(r3, r4, r5, r6, r7);
        goto L_0x007c;
    L_0x0059:
        if (r7 != 0) goto L_0x007c;
    L_0x005b:
        r2.onNestedPreScroll(r3, r15, r5, r13);	 Catch:{ AbstractMethodError -> 0x005f }
        goto L_0x007c;
    L_0x005f:
        r0 = move-exception;
        r3 = r0;
        r0 = new java.lang.StringBuilder;
        r0.<init>();
        r4 = "ViewParent ";
        r0.append(r4);
        r0.append(r2);
        r2 = " does not implement interface method onNestedPreScroll";
        r0.append(r2);
        r0 = r0.toString();
        r2 = "ViewParentCompat";
        android.util.Log.e(r2, r0, r3);
    L_0x007c:
        if (r8 == 0) goto L_0x008d;
    L_0x007e:
        r0 = r1.c;
        r0.getLocationInWindow(r8);
        r0 = r8[r10];
        r0 = r0 - r11;
        r8[r10] = r0;
        r0 = r8[r9];
        r0 = r0 - r12;
        r8[r9] = r0;
    L_0x008d:
        r0 = r13[r10];
        if (r0 != 0) goto L_0x0097;
    L_0x0091:
        r0 = r13[r9];
        if (r0 == 0) goto L_0x0096;
    L_0x0095:
        goto L_0x0097;
    L_0x0096:
        r9 = 0;
    L_0x0097:
        return r9;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.i.k.g.c(int, int, int[], int[], int):boolean");
    }

    public void d(int i, int i2, int i3, int i4, int[] iArr, int i5, int[] iArr2) {
        f(i, i2, i3, i4, null, i5, iArr2);
    }

    public boolean e(int i, int i2, int i3, int i4, int[] iArr) {
        return f(i, i2, i3, i4, iArr, 0, null);
    }

    public final boolean f(int i, int i2, int i3, int i4, int[] iArr, int i5, int[] iArr2) {
        int[] iArr3 = iArr;
        int i6 = i5;
        if (this.d) {
            ViewParent g = g(i6);
            if (g == null) {
                return false;
            }
            if (i != 0 || i2 != 0 || i3 != 0 || i4 != 0) {
                int i7;
                int i8;
                int[] iArr4;
                if (iArr3 != null) {
                    this.c.getLocationInWindow(iArr3);
                    i7 = iArr3[0];
                    i8 = iArr3[1];
                } else {
                    i7 = 0;
                    i8 = 0;
                }
                if (iArr2 == null) {
                    if (this.e == null) {
                        this.e = new int[2];
                    }
                    int[] iArr5 = this.e;
                    iArr5[0] = 0;
                    iArr5[1] = 0;
                    iArr4 = iArr5;
                } else {
                    iArr4 = iArr2;
                }
                View view = this.c;
                if (g instanceof i) {
                    ((i) g).m(view, i, i2, i3, i4, i5, iArr4);
                } else {
                    iArr4[0] = iArr4[0] + i3;
                    iArr4[1] = iArr4[1] + i4;
                    if (g instanceof h) {
                        ((h) g).n(view, i, i2, i3, i4, i5);
                    } else if (i6 == 0) {
                        try {
                            g.onNestedScroll(view, i, i2, i3, i4);
                        } catch (AbstractMethodError e) {
                            Throwable th = e;
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.append("ViewParent ");
                            stringBuilder.append(g);
                            stringBuilder.append(" does not implement interface method onNestedScroll");
                            Log.e("ViewParentCompat", stringBuilder.toString(), th);
                        }
                    }
                }
                if (iArr3 != null) {
                    this.c.getLocationInWindow(iArr3);
                    iArr3[0] = iArr3[0] - i7;
                    iArr3[1] = iArr3[1] - i8;
                }
                return true;
            } else if (iArr3 != null) {
                iArr3[0] = 0;
                iArr3[1] = 0;
            }
        }
        return false;
    }

    public final ViewParent g(int i) {
        if (i != 0) {
            return i != 1 ? null : this.b;
        } else {
            return this.a;
        }
    }

    public boolean h(int i) {
        return g(i) != null;
    }

    public boolean i(int i, int i2) {
        if ((g(i2) != null ? 1 : null) != null) {
            return true;
        }
        if (this.d) {
            View view = this.c;
            for (Object parent = this.c.getParent(); parent != null; parent = parent.getParent()) {
                boolean o;
                View view2 = this.c;
                boolean z = parent instanceof h;
                String str = "ViewParentCompat";
                String str2 = "ViewParent ";
                if (z) {
                    o = ((h) parent).o(view, view2, i, i2);
                } else {
                    if (i2 == 0) {
                        try {
                            o = parent.onStartNestedScroll(view, view2, i);
                        } catch (AbstractMethodError e) {
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.append(str2);
                            stringBuilder.append(parent);
                            stringBuilder.append(" does not implement interface method onStartNestedScroll");
                            Log.e(str, stringBuilder.toString(), e);
                        }
                    }
                    o = false;
                }
                if (o) {
                    if (i2 == 0) {
                        this.a = parent;
                    } else if (i2 == 1) {
                        this.b = parent;
                    }
                    View view3 = this.c;
                    if (z) {
                        ((h) parent).h(view, view3, i, i2);
                    } else if (i2 == 0) {
                        try {
                            parent.onNestedScrollAccepted(view, view3, i);
                        } catch (AbstractMethodError e2) {
                            StringBuilder stringBuilder2 = new StringBuilder();
                            stringBuilder2.append(str2);
                            stringBuilder2.append(parent);
                            stringBuilder2.append(" does not implement interface method onNestedScrollAccepted");
                            Log.e(str, stringBuilder2.toString(), e2);
                        }
                    }
                    return true;
                }
                if (parent instanceof View) {
                    view = (View) parent;
                }
            }
        }
        return false;
    }

    public void j(int i) {
        ViewParent g = g(i);
        if (g != null) {
            View view = this.c;
            if (g instanceof h) {
                ((h) g).i(view, i);
            } else if (i == 0) {
                try {
                    g.onStopNestedScroll(view);
                } catch (AbstractMethodError e) {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("ViewParent ");
                    stringBuilder.append(g);
                    stringBuilder.append(" does not implement interface method onStopNestedScroll");
                    Log.e("ViewParentCompat", stringBuilder.toString(), e);
                }
            }
            if (i == 0) {
                this.a = null;
            } else if (i == 1) {
                this.b = null;
            }
        }
    }
}
